package io.renren.modules.hotel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.hotel.dao.QuestionDao;
import io.renren.modules.hotel.entity.QuestionEntity;
import io.renren.modules.hotel.service.QuestionService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

@Slf4j
@Service("questionService")
public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity> implements QuestionService {
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String describable = (String) params.get("describable");
//        IPage<QuestionEntity> page = this.page(new Query<QuestionEntity>().getPage(params));
        IPage<QuestionEntity> page = this.page(new Query<QuestionEntity>().getPage(params),
                new QueryWrapper<QuestionEntity>().like(StringUtils.isNotBlank(describable),"describable",describable));
        return new PageUtils(page);
    }
}
